package com.hziee.cosmanage.member.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hziee.common.utils.PageUtils;
import com.hziee.common.utils.Query;

import com.hziee.cosmanage.member.dao.CertificateDao;
import com.hziee.cosmanage.member.entity.CertificateEntity;
import com.hziee.cosmanage.member.service.CertificateService;


@Service("certificateService")
public class CertificateServiceImpl extends ServiceImpl<CertificateDao, CertificateEntity> implements CertificateService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CertificateEntity> page = this.page(
                new Query<CertificateEntity>().getPage(params),
                new QueryWrapper<CertificateEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<CertificateEntity> getCertificates(Integer userId) {
        List<CertificateEntity> certificateEntities = this.list(new QueryWrapper<CertificateEntity>().eq("user_id", userId));
        return certificateEntities;
    }

}